<template>
  <div class="min-h-200">
    <MyTable
      ref="$table"
      :columns="columns"
      :get-data="(params) => projectApi.logList(params, detail.id)"
      :index="true"
      :auto-load="false"
      list-key="/projectLog:get"
    ></MyTable>
  </div>
</template>
<script setup lang="jsx">
import * as projectApi from '@/api/project'
defineOptions({ name: 'ProjectLog' })
const props = defineProps({
  detail: {
    type: Object,
    default: () => ({}),
  },
})
const columns = [
  { key: 'modelName', title: '操作模块' },
  { key: 'columnName', title: '操作字段' },
  { key: 'operationTypeName', title: '操作行为' },
  { key: 'updateBefore', title: '操作前' },
  { key: 'updateAfter', title: '操作后' },
  { key: 'createUserName', title: '操作人' },
  { key: 'createTime', title: '操作时间', render: ({ createTime }) => $format(createTime) },
]
const $table = ref(null)
watch(
  () => props.detail.id,
  (val) => {
    if (val) {
      nextTick(() => {
        $table.value.handleQuery()
      })
    }
  },
  {
    immediate: true,
  }
)
</script>
<style lang="scss" scoped></style>
